<template>
  <div>

    <el-row>
      <el-col :span="24">
        <div class="grid-content bg-purple-dark">
          <h2>修改销售价格</h2>
        </div>
      </el-col>
    </el-row>

    <el-card class="box-card">
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>商品图片:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="block">
            <el-image :src="imgSrc"></el-image>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>
      <br>
      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>商品编号:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <span>{{ productNumber }}</span>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>
      <br>
      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>商品名称:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <span>{{ productName }}</span>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>
      <br>
      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>厂家:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <span>{{ productFirm }}</span>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>
      <br>
      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>类别:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <span>{{ productClass }}</span>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>
      <br>
      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>建议采购价:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <span>{{ productBuyer }}</span>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>
      <br>
      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>库存数量:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <span>{{ stockNumber }}</span>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>
      <br>
      <p/>
      <el-row>
        <el-col :span="5" class="labClass">
          <div class="grid-content bg-purple">
            <span>建议销售价:</span>
          </div>
        </el-col>
        <el-col :span="16">
          <div class="grid-content bg-purple-light">
            <el-input v-model="productSell" placeholder="建议销售价"></el-input>
          </div>
        </el-col>
        <el-col :span="3" class="labClass">
          <div class="grid-content bg-purple">
          </div>
        </el-col>
      </el-row>
      <p/>

      <el-button type="success" @click="update">修改</el-button>
    </el-card>

  </div>
</template>

<script>
export default {
  name: "updateProductSell",
  data() {
    return {
      stock: '',

      productNumber: '',
      productName: '',
      productFirm: '',
      productClass: '',
      productBuyer: '',
      stockNumber: '',
      productSell: '',
      imgSrc: ''
    }
  },
  methods: {
    init(stock) {
      console.log('drp/img/' + stock.productBean.imgPath)
      this.stock = stock;
      this.productNumber = stock.productBean.number
      this.productName = stock.productBean.productName
      this.productFirm = stock.productBean.productFirm
      this.productClass = stock.productBean.productClass
      this.productBuyer = stock.productBean.productBuyer
      this.stockNumber = stock.number
      this.productSell = stock.productBean.productSell
      this.imgSrc = 'drp/img/' + stock.productBean.productImgPath
    },
    update() {
      let formData = new FormData()
      formData.append("productId", this.stock.productBean.productId)
      formData.append("sellMoney", this.productSell)
      this.$axios.post('drp/product/updateProductSell', formData).then(
          r => {
            console.log(r.data)
            if (r.data == 'ok') {
              location.href = "/index"
            }
          }
      )
    }
  }
}
</script>

<style scoped>

</style>